package com.spyx.acl.controller;


import com.spyx.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@Api(tags = "用户伪登录接口")
@RestController
@RequestMapping("/admin/acl/index")
//@CrossOrigin  //解决跨域问题
public class IndexController {

    //登录
    //  java->json
    /*
     {
       code:200,
       message:"",
       data:{
          "token":"admin-spyx"
       }
     }
     */
    @ApiOperation("登录接口")
    @PostMapping("login")
    public Result  login(){
        Map map=new HashMap();
        map.put("token","admin-spyx");
        return Result.ok(map);
    }

    //获取用户信息
    @ApiOperation("获取用户信息接口")
    @GetMapping("info")
    public Result  getInfo(){
        Map map=new HashMap();
        map.put("name","郭秦宁");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }
    //退出
    @ApiOperation("退出接口")
    @PostMapping("logout")
    public Result logout(){
        return Result.ok();
    }

}
